{extend name="base"/}
{block name="resources"}
<style type="text/css">
    .layui-input-block input,
    .layui-input-block input,
    .layui-input-block textarea {outline: none;border: none;}
    .ns-form-row{margin-top: 0;}
    .ns-store-company{margin-top: 10px;}
</style>
{/block}
{block name="main"}
<div class="layui-form">
    <div class="layui-card ns-card-common ns-card-brief">
        <div class="layui-card-header">
            <span class="ns-card-title">店铺信息</span>
        </div>
        <div class="layui-card-body">
            <div class="layui-form-item">
                <label class="layui-form-label">店铺名称：</label>
                <div class="layui-input-block">
                    <input disabled name="shop_name" type="text" value="{$apply_detail.shop_name}" class="layui-input ns-len-mid">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">店铺分类：</label>
                <div class="layui-input-block ns-len-mid">
                    <input disabled name="category_name" type="text" value="{$apply_detail.category_name}" class="layui-input ns-len-mid">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">店铺类型：</label>
                <div class="layui-input-block ns-len-mid">
                    <input disabled name="group_name" type="text" value="{$apply_detail.group_name}" class="layui-input ns-len-mid">
                </div>
            </div>

            <div class="layui-form-item">
               <label class="layui-form-label">店铺地址：</label>
               <div class="layui-input-block">
                   <p class="ns-input-text">{$apply_detail.full_address}{$apply_detail.address}</p>
               </div>
           </div>

            <div class="layui-form-item">
                <label class="layui-form-label">营业时间：</label>
                <div class="layui-input-block">
                    <p class="ns-input-text">{$apply_detail.start_time_show}-{$apply_detail.end_time_show}</p>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">联系人：</label>
                <div class="layui-input-block">
                    <p class="ns-input-text">{$apply_detail.name}</p>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">联系电话：</label>
                <div class="layui-input-block">
                    <p class="ns-input-text">{$apply_detail.mobile}</p>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">联系人邮箱：</label>
                <div class="layui-input-block">
                    <p class="ns-input-text">{$apply_detail.contact_email}</p>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label img-upload-lable">店铺列表图：</label>
                <div class="layui-input-block img-upload">
                    <div class="upload-img-block icon">
                        <div class="upload-img-box" id="avatar">
                            <img layer-src src="{:img($apply_detail.avatar)}" alt="">
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label img-upload-lable">店铺详情图：</label>
                <div class="layui-input-block img-upload">
                    <div class="upload-img-block icon" style="border: 0px;">
                        <div class="upload-img-box" id="banner">
                        {foreach $apply_detail.banner as $k => $v}
                            <img layer-src src="{:img($v)}" alt="" style="position: relative;">
                        {/foreach}
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <div class="layui-card ns-card-common ns-card-brief">
        <div class="layui-card-header">
            <span class="ns-card-title">认证类型</span>
        </div>
        <div class="layui-card-body">
            <div class="layui-form-item">
                <label class="layui-form-label">认证类型：</label>
                <div class="layui-input-block ns-len-mid">
                    {if condition="$apply_detail.cert_type == 1"}
                    <input disabled type="text" name="cert_type" value="个人店铺" autocomplete="off" class="layui-input ns-len-small">
                    {/if}
                    {if condition="$apply_detail.cert_type == 2"}
                    <input disabled type="text" name="cert_type" value="企业店铺" autocomplete="off" class="layui-input ns-len-small">
                    {/if}
                </div>
            </div>
        </div>
    </div>

    <!-- 联系人手机号身份证 -->
    <div class="layui-card ns-card-common ns-card-brief">
        <div class="layui-card-header">
            <span class="ns-card-title">联系人信息</span>
        </div>
        <div class="layui-card-body">
            <div class="layui-form-item">
                <label class="layui-form-label img-upload-lable ns-company-pic-front">申请人身份证正面：</label>
                <div class="layui-input-block img-upload">
                    <div class="upload-img-block icon">
                        <div class="upload-img-box" id="idCardPicFront">
                            <img layer-src src="{:img($apply_detail.contacts_card_electronic_2)}" alt="">
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label img-upload-lable ns-company-pic-back">申请人身份证反面：</label>
                <div class="layui-input-block img-upload">
                    <div class="upload-img-block icon">
                        <div class="upload-img-box" id="idCardPicBack">
                            <img layer-src src="{:img($apply_detail.contacts_card_electronic_3)}" alt="">
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label ns-company-name">证件姓名：</label>
                <div class="layui-input-block">
                    <input disabled name="contacts_card_name" type="text" value="{$apply_detail.contacts_card_name}" class="layui-input ns-len-mid">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label ns-company-phone">证件号码：</label>
                <div class="layui-input-block">
                    <input disabled name="contacts_card_no" type="text" value="{$apply_detail.contacts_card_no}" class="layui-input ns-len-mid">
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label ns-company-ident">证件地址：</label>
                <div class="layui-input-block">
                    <input disabled name="legal_addr" type="text" value="{$apply_detail.legal_addr}" class="layui-input ns-len-mid">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label ns-company-ident">证件类型：</label>
                <div class="layui-input-block">
                    <input disabled name="contacts_card_type" type="text" value="{$apply_detail.contacts_card_type}" class="layui-input ns-len-mid">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">有效期类型：</label>
                <div class="layui-input-block ns-len-mid">
                    <p name="legal_cert_validity_type" class="ns-input-text" disabled>{$apply_detail.legal_cert_validity_type==1?'长期有效':'非长期有效'}</p>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">证件有效期：</label>
                <div class="layui-input-block">
                    <p class="ns-input-text">{$apply_detail.contacts_card_start_time}-{$apply_detail.contacts_card_end_time}</p>
                </div>
            </div>
        </div>
    </div>

    <div class="layui-card ns-card-common ns-card-brief">
        <div class="layui-card-header">
            <span class="ns-card-title">开户行信息</span>
        </div>
        <div class="layui-card-body">
            <div class="layui-form-item">
                <label class="layui-form-label">开户人：</label>
                <div class="layui-input-block">
                    <p class="ns-input-text">{$apply_detail.settlement_bank_account_name}</p>
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">开户行：</label>
                <div class="layui-input-block">
                    <p class="ns-input-text">{$apply_detail.settlement_bank_name}</p>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">银行卡号：</label>
                <div class="layui-input-block">
                    <p class="ns-input-text">{$apply_detail.settlement_bank_account_number}</p>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">银行卡类型：</label>
                <div class="layui-input-block">
                    <p class="ns-input-text">
                        {if $apply_detail.settlement_bank_type==1}
                        对公
                        {/if}
                        {if $apply_detail.settlement_bank_type==2}
                        对私
                        {/if}
                        {if $apply_detail.settlement_bank_type==3}
                        对私非法人
                        {/if}

                    </p>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label img-upload-lable ns-company-pic-back">银行卡图片：</label>
                <div class="layui-input-block img-upload">
                    <div class="upload-img-block icon">
                        <div class="upload-img-box" id="settlement_bank_img">
                            <img layer-src src="{:img($apply_detail.settlement_bank_img)}" alt="">
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 企业店铺独有 -->
    {if condition="$apply_detail.cert_type == 2"}
    <div class="ns-store-company">

        <!-- 营业执照 税务 -->
        <div class="layui-card ns-card-common ns-card-brief">
            <div class="layui-card-header">
                <span class="ns-card-title">企业资质</span>
            </div>
            <div class="layui-card-body">


                <div class="layui-form-item">
                    <label class="layui-form-label">经营类型：</label>
                    <div class="layui-input-block ns-len-mid">
                        <p name="busi_type" class="ns-input-text" disabled>{$apply_detail.busi_type==1?'实体':'虚拟'}</p>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">统一社会信用码：</label>
                    <div class="layui-input-block">
                        <input disabled name="business_licence_number" type="text" value="{$apply_detail.business_licence_number}" class="layui-input ns-len-mid">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label img-upload-lable">营业执照电子版：</label>
                    <div class="layui-input-block img-upload">
                        <div class="upload-img-block icon">
                            <div class="upload-img-box" id="license">
                                <img layer-src src="{:img($apply_detail.business_licence_number_electronic)}" alt="">
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">有效期类型：</label>
                    <div class="layui-input-block ns-len-mid">
                        <p name="license_time_type" class="ns-input-text" disabled>{$apply_detail.license_time_type==1?'长期有效':'有期限'}</p>
                    </div>
                </div>
                {if $apply_detail.license_time_type==1}
                <div class="layui-form-item">
                    <label class="layui-form-label">有效期：</label>
                    <div class="layui-input-block">
                        <p class="ns-input-text">{$apply_detail.license_start_date}-{$apply_detail.license_end_date}</p>
                    </div>
                </div>
                {/if}
            </div>
        </div>
        {/if}


        <div class="layui-card ns-card-common ns-card-brief" hidden>
            <div class="layui-card-header">
                <span class="ns-card-title">审核状态</span>
            </div>
            <div class="layui-card-body">
                {if condition="$apply_detail.apply_state == 1"}
                <div class="layui-form-item">
                    <label class="layui-form-label">审核状态：</label>
                    <div class="layui-input-block">
                        <input disabled name="apply_state" type="text" value="认证信息审核中" class="layui-input ns-len-mid">
                    </div>
                </div>

                <div class="ns-form-row">
                    <button class="layui-btn ns-bg-color" lay-submit lay-filter="apply_pass">同意申请</button>
                    <button class="layui-btn ns-bg-color" lay-submit lay-filter="apply_message">拒绝申请</button>
                    <button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
                </div>
                {/if}

                {if condition="$apply_detail.apply_state == -1"}
                <div class="layui-form-item">
                    <label class="layui-form-label">审核状态：</label>
                    <div class="layui-input-block">
                        <input disabled name="apply_state" type="text" value="认证信息审核失败" class="layui-input ns-len-mid">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">拒绝理由：</label>
                    <div class="layui-input-block">
                        <input disabled name="apply_message" type="text" value="{$apply_detail.apply_message}" class="layui-input ns-len-mid">
                    </div>
                </div>

                <div class="ns-form-row">
                    <button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
                </div>
                {/if}

                {if condition="$apply_detail.apply_state == 2"}
                <div class="layui-form-item">
                    <label class="layui-form-label">审核状态：</label>
                    <div class="layui-input-block">
                        <input disabled name="apply_state" type="text" value="财务审核" class="layui-input ns-len-mid">
                    </div>
                </div>

                <div class="ns-form-row">
                    <button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
                </div>
                {/if}

                {if condition="$apply_detail.apply_state == -2"}
                <div class="layui-form-item">
                    <label class="layui-form-label">审核状态：</label>
                    <div class="layui-input-block">
                        <input disabled name="apply_state" type="text" value="财务审核失败" class="layui-input ns-len-mid">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">拒绝理由：</label>
                    <div class="layui-input-block">
                        <input disabled name="apply_message" type="text" value="{$apply_detail.apply_message}" class="layui-input ns-len-mid">
                    </div>
                </div>

                <div class="ns-form-row">
                    <button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
                </div>
                {/if}

                {if condition="$apply_detail.apply_state == 3"}
                <div class="layui-form-item">
                    <label class="layui-form-label">审核状态：</label>
                    <div class="layui-input-block">
                        <input disabled name="apply_state" type="text" value="入驻通过" class="layui-input ns-len-mid">
                    </div>
                </div>

                <div class="ns-form-row">
                    <button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
                </div>
                {/if}
            </div>
        </div>

        {if condition="$apply_detail.apply_state == 2"}
        <!-- <div class="ns-single-filter-box">

            <div class="ns-form-row">
                <button class="layui-btn ns-bg-color" lay-submit lay-filter="open_shop">入驻通过</button>
                <button class="layui-btn ns-bg-color" lay-submit lay-filter="edit_apply">修改资料</button>
                <button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
            </div>
        </div> -->
        {/if}

        <input name="apply_id" type="text" value="{$apply_detail.apply_id}" class="layui-input layui-hide">
        <input id="cert_type" type="text" value="{$apply_detail.cert_type}" class="layui-input layui-hide">
    </div>
    {/block}
    {block name="script"}
    <script>
        layui.use(['form'], function() {
            var form = layui.form;

            // 同意申请
            form.on('submit(apply_pass)', function(data) {
                layer.confirm('确定要通过审核吗?', function() {

                    $.ajax({
                        url: ns.url("admin/shopapply/applyPass"),
                        data: {
                            "apply_id": data.field.apply_id,
                        },
                        dataType: 'JSON', //服务器返回json格式数据
                        type: 'POST', //HTTP请求类型
                        success: function(res) {
                            layer.msg(res.message);
                            if (res.code == 0) {
                                location.reload();
                            }
                        }
                    });
                });
            });

            // 拒绝申请
            form.on('submit(apply_message)', function(data) {
                /**
                 * 拒绝理由弹窗
                 */
                layer.prompt({
                    formType: 2,
                    value: '',
                    title: '请输入拒绝理由',
                    area: ['300px', '100px'], //自定义文本域宽高
                    yes: function(index, layero) {
                        // 获取文本框输入的值
                        var value = layero.find(".layui-layer-input").val();

                        if (value) {
                            $.ajax({
                                url: ns.url("admin/shopapply/applyReject"),
                                data: {
                                    "apply_id": data.field.apply_id,
                                    "reason": value
                                },
                                dataType: 'JSON', //服务器返回json格式数据
                                type: 'POST', //HTTP请求类型
                                success: function(res) {
                                    layer.msg(res.message);
                                    if (res.code == 0) {
                                        location.reload();
                                    }
                                }
                            });
                            layer.close(index);
                        } else {
                            layer.msg('请输入拒绝原因!', {icon: 5, anim: 6});
                        }
                    }
                });
            });
        });



        function back() {
            location.href = ns.url("admin/shopapply/apply")
        }

    </script>
    {/block}